﻿@model IEnumerable<VehicleManagement.Models.AddGas>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="../../Content/css/page_yk_index.css" rel="stylesheet" type="text/css" />
@Html.Partial("_PartviewDrivermanageNav")
<div class="content bc">
    <div class="content_link_warn f12">
        你当前的位置：车辆管理&gt&gt &nbsp;&nbsp;车辆加油&gt&gt &nbsp;&nbsp;所有加油列表
    </div>
    <div class="content_right fr" id="rightcontent">
        <div class="column">
            <h4 class="title f14">
                加油信息
            </h4>
        </div>
        <div class="maincontent">
            <div class="menuwrap">
                <div class="submenu">
                    @using (Html.BeginForm("Index", "AddGas", FormMethod.Get, new { id = "SearchForm" }))
                    {
                        @Html.Hidden("Page");
                        <div class="box_num dil m010">
                            <span class="label">车牌号</span> <span>
                                <input type="text" name="Car_num" class="txt_num w100" id="num" title="输入车牌号查找" />
                            </span>
                        </div>
                        <div class="box_name dil m010">
                            <span class="label">燃油姓名</span> <span>
                                <input type="text" name="Gas_Name" class="txt_name w100" id="name" title="输入司机姓名查找" />
                            </span>
                        </div>
                        @*<div class="box_date dil m010">
                            <span class="label">是否审批</span> <span>
                                <input type="text" class="txt_date w100" id="date" title="输入日期查找" />
                            </span>
                        </div>*@
                              <div class="box_name dil m010">
                            <span class="label">是否审批</span> <span>
                                <select name="Apploval">
                                    <option></option>
                                    <option>未审批</option>
                                    <option>已审批</option>
                                </select>
                            </span>
                        </div>
                        <div class="box_find dil m010">
                            <input type="submit" class="btn_fc f14" id="find" value="查询" title="查询记录" />
                        </div>
                        <div class="box_create dil m010">
                            <span class="btn_fc f14 h20" title="添加新记录">@Html.ActionLink("添加", "Create")</span>
                        </div>
                    }
                </div>
            </div>
            <div class="driveinfolist tc">
                <table class="tb_list f14">
                    <tr class="tr_head tf">
                        <th class="wp2">
                        </th>
                        <th class="wp15 tc bdl">
                            车牌号
                        </th>
                        <th class="wp10 tc bdl">
                            司机姓名
                        </th>
                        <th class="wp20 tc bdl">
                            日期
                        </th>
                        <th class="wp10 tc bdl">
                            总费用
                        </th>
                        <th class="wp20 tc bdl">
                            备注
                        </th>
                        <th class="wp20 tc bdl">
                            操作
                        </th>
                        <th class="wp2 bdl">
                        </th>
                    </tr>
                    @foreach (var item in Model)
                    {
   
                        <tr>
                            <td>
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Car_num)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Driver_name)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Gas_Date)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Cost)
                            </td>
                            <td>
                                <div class="setremark">@Html.DisplayFor(modelItem => item.Remark)</div>
                            </td>
                            <td>
                                @Html.ActionLink("编辑", "Edit", new { id = item.AddGasID }) |
                                @Html.ActionLink("详情", "Details", new { id = item.AddGasID }) | <a href="javascript:void(0)" onclick="DeleteAddGas(@item.AddGasID)">
                                    删除</a>
                            </td>
                            <td>
                            </td>
                        </tr>
                    }
                </table>
            </div>
            <div class="pagewrap">
                共<span id="TotalItems" class="allitems numstyle"></span>条记录， 每页显示<span id="ItemsPerPage"
                    class="itemsperpage numstyle"></span>条， 共<span id="TotalPages" class="allpages numstyle"></span>页，
                当前第<span id="CurrentPage" class="curpage numstyle"></span>页 <a id="FirstPage" class="fir_page"
                    href="javascript:void(0)">首页</a> <a id="PrevPage" class="pre_page" href="javascript:void(0)">
                        上一页</a> <a id="NextPage" class="next_page" href="javascript:void(0)">下一页</a>
                <a id="LastPage" class="last_page" href="javascript:void(0)">末页</a> <span>跳转到</span>
                <input type="text" class="input_page" id="PageToGo" />
                <input type="button" class="btn_gotopage" id="GoToPage" value="Go" />
            </div>
        </div>
    </div>
   @Html.Partial("_PartviewCarLeftbar")
    <div class="content_contract fl">
        <a href="javascript:void(0)" class="btn_contract w8h32" id="contract" title="收缩">
        </a><a href="javascript:void(0)" class="btn_expand w8h32" id="expand" title="展开">
        </a>
    </div>
    <div class="cb">
    </div>
</div>
<script type="text/javascript" src="../../Scripts/jquery-1.5.1.js"></script>
<script src="../../Scripts/deleteFunction.js" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.query-2.1.7.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function () {
        $("tr:even").css("background-color", "#D7DBE4");

        function DeleteAddGas(id) {
            if (confirm("你确认删除这条加油信息吗?")) {
                $.post("/AddGas/DeleteAddGas", "id=" + id, function (ret) {
                    if (ret.Result == "true") {
                        alert(ret.Message);
                        window.location.reload();
                    }
                    else {
                        alert(ret.Message);
                    }
                }, "json");
            }
        };

        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("Car_num").toString() != "true") {
            $("input[name='Car_num']").val($.query.get("Car_num"));
        }

        if ($.query.get("Gas_Name").toString() != "true") {
            $("input[name='Gas_Name']").val($.query.get("Gas_Name"));
        }

        if ($.query.get("Approval").toString() != "true") {
            $("input[name='Approval']").val($.query.get("Approval"));
        }

        $.get("/AddGas/GetPagingInfo",
            {
                Car_num: $("input[name='Car_num']").val(),
                Gas_Name: $("input[name='Gas_Name']").val(),
                Approval: $("input[name='Approval']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
</script>
